/**
 *  @file
 *  @brief   MICT(Mixed Interpolation of Tensorial Components) 方法的三角形板
 *  @author  yangtianxing
 *  @date    2024.05.9
 *  @version  v1.0
 *  @par Copyright(c):  ShenGong  Simulation corporation
 */

#pragma once
#include "DataStructure/Common/Out.h"
#include "Utility/Algebra/Matrix.h"

#include "SGFem/Integration/IntegrationFormula/Gauss2DTria3P.h"
#include "SGFem/ShellSecCalculator/ShellSectionParser1.h"
#include "../Common/PublicElementExport.h"

class PublicElement_DECLSPEC MITC3PlateCalculator
{
  public:
    MITC3PlateCalculator () = default;

    /// @brief 计算和节点坐标无关的变量
    void Initialize ();

    ///< do nothing, 和 TMT板接口统一， 淘汰 TMT板后，删除函数
    void SetCoordinate (const SG::Algebra::Matrix&                  localCoord,
      const SG::FEMSolver::Element::ShellSectionProp1& SecConstant) {};

    /** @brief 计算弯曲和剪切部分应变矩阵
     * 
     * 弯曲部分使用常应变，剪切部分使用MICT3
     * @param [in] iGauss 积分点索引
     * @param [in] coord 单元节点坐标
     * @param [out] B    应变矩阵
     * @param [out] j 积分点雅克比的行列式值
     */
    void ComputeB (std::size_t                iGauss,
                    const SG::Algebra::Matrix& coord,
                    _OUT SG::Algebra::Matrix& Bs,
                    _OUT SG::Algebra::Matrix& Bb,
                    _OUT SG::DataStructure::Common::Real& j) const;

    /**  @brief 计算单元刚度矩阵
     * @param [in] coord   节点局部坐标
     * @param [in] thickness 节点处壳厚度值
     * @param [in] SecConstant  截面属性，需要用到膜部分材料刚度 Cm, 厚度 t 以及 剪切模量 G
     */
    SG::Algebra::Matrix ComputeStiffness (const SG::Algebra::Matrix&                              coord,
                                          const SG::DataStructure::Common::Real* const            thickness,
                                          const SG::FEMSolver::Element::ShellSectionProp1& SecConstant) const;

  private:
    SG::FEMSolver::Element::Gauss2DTria3P m_integForm;  ///< 积分格式
    static std::size_t                    s_nNode;
};